#!/bin/bash
#START_HAPROXY="/home/haproxy/haproxy-1.7.8/haproxy -f /home/haproxy/haproxy-1.7.8/conf/haproxy.cfg"
#LOG_FILE="/etc/keepalived/log/haproxy-check.log"
#HAPS=`ps -C haproxy --no-header |wc -l`
#date "+%Y-%m-%d %H:%M:%S" >> $LOG_FILE
#echo "check haproxy status" >> $LOG_FILE
#if [ $HAPS -eq 0 ];then
#echo $START_HAPROXY >> $LOG_FILE
#$START_HAPROXY >> $LOG_FILE 2>&1
#sleep 3
if [ `ps -C haproxy --no-header |wc -l` -eq 0 ];then
#echo "start haproxy failed, killall keepalived" >> $LOG_FILE
pkill keepalived
fi
#fi
